<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>


<c:set var="ctx" value="${pageContext.request.contextPath}" />

<!DOCTYPE html>
<html>
<head>
<title>找回密码页面</title>
<%@include file="../collect/meta.jsp"%>
<!--  
<link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css"
	rel="stylesheet">
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
-->
<script src="${ctx}/js/md5.js"></script>
</head>


<body lang="zh-cn" style="background-color: #eeeeee;font-family: '微软雅黑';">

	<div class="panel-body" align="center" style="background-color:#438EB8">
		<div class="navbar-brand"
			style="font-size:28px;color:#ffffff;margin-left: 100px;">取回密码</div>
	</div>

	<form class="form-horizontal" action="maccount!updatePassword" name="formsubmit">
		<div class="panel panel-default"
			style="width:800px;height:500px;margin:auto;">
			<div
				style="font-size: 24px;border-bottom:1px dashed gray; height: 100px;">
				<p style="padding:30px 0px 0px 30px;">
					无觅账户 > <span style="color: #FF9933">重设账号密码</span>
				</p>
			</div>

			<div class="form-group" align="center"
				style="margin-top:80px; margin-right:470px;">
				<div>请重设您的帐号密码</div>
			</div> 

			<div class="form-group" style="padding-top:20px;">
     	 	<label for="newpassword" class="col-sm-2 control-label">新密码</label>
     	 	<div class="col-sm-5">
         	<input type="password" class="form-control" id="newpassword"  name="password"
            placeholder="请输入新密码" onblur="checkpass()">
      		</div>
   		</div>
   		
   		<div style="margin-left: 450px; margin-top: -45px;" id="password11">
   			
   		</div>
   		
   		<div class="form-group" style="padding-top:40px;padding-left:0px; ">
     	 	<label for="renewpassword" class="col-sm-2 control-label">确认密码</label>
     	 	<div class="col-sm-5">
         	<input type="password" class="form-control" id="renewpassword" 
            placeholder="请确认新密码" onblur="checkpass();" >
      		</div>
   		</div>
		<div style="display: none;"><input type="text"  value="${findPassword }" name="findPassword"></div>
			<div class="form-group" style="margin: 40px 0px 0px 200px;">
				<button type="button" class="btn btn-default" id="submit1" onclick="subTheForm();">提交</button>
			</div>
		</div>

		<div style="margin-top: 50px;">
			<c:import url="/collect/down.jsp"></c:import>
		</div>
	</form>
	<script type="text/javascript">
		function checkpass() {
			var password1 = $("#newpassword").val();
			var password2 = $("#renewpassword").val();
			
			if(password1==null||password1==""){
				$("div[id='password11']").html(
							"<font color='red'>新密码不能为空</font>");
							return false;
			}
			if (password2== ""||password2==null) {
				$("div[id='password11']").html(
							"<font color='red'>确认密码不能为空</font>");
							return false;
				
			}
			if (password1 != password2 || password2 != password1) {
				$("div[id='password11']").html(
						"<font color='red'>两次密码输入不一致</font>");
						return false;
				}
				else {
					$("div[id='password11']").html("");
					return true;
				}
			}


		function subTheForm() {
			var password1 = $("#newpassword").val();
			var password2 = $("#renewpassword").val();
			
				if(password1==null||password1==''){
					$("div[id='password11']").html(
							"<font color='red'>新密码不能为空</font>");
							return false;
				}
				if(password2 == ''||password2==null) {
					$("div[id='password11']").html(
							"<font color='red'>确认密码不能为空</font>");
							return false;
				}
				
				if(password1!=null&&password2==null||password1!=""&&password2==""){
					$("div[id='password11']").html(
							"<font color='red'>确认密码不能为空</font>");
							return false;
				}
				
				if(password2!=null&&password1==null||password2!=""&&password1==""){
					$("div[id='password11']").html(
							"<font color='red'>新密码不能为空</font>");
							return false;
				}
				
				if(password1 != password2) {
					$("div[id='password11']").html("<font color='red'>两次密码输入不一致</font>");
							return false;
				} else if (password2 != password1) {
					$("div[id='password11']").html(
						"<font color='red'>两次密码输入不一致</font>");
							return false;
				} else {
					$("#newpassword").val(faultylabs.MD5($("#newpassword").val()));
					formsubmit.submit();
							return true;
		    }
		}
		
	</script>
</body>
</html>
